package com.project.webservice.controller;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.util.DateUtils;
import com.project.util.JSONUtils;
import com.project.webservice.dto.*;
import com.project.webservice.entity.*;
import com.project.webservice.service.*;

import com.project.dto.R;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;



import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Slf4j
@RestController
@RequestMapping("/webservice")
public class WebServiceController {
    @Resource
    private HttpServletRequest request;
    @Resource
    private HttpServletResponse response;
    @Resource
    private JgGjxlService jgGjxlService;
    @Resource
    private JkXlxxMidService jkXlxxMidService;
    @Resource
    private JkXlzjMidService jkXlzjMidService;
    @Resource
    private JkLdxxInService jkLdxxInService;
    @Resource
    private JkXlbcskService jkXlbcskService;
    @Resource
    private TbRidVenderService tbRidVenderService;
    @Resource
    private JkXlbcskDetailService jkXlbcskDetailService;
    @Resource
    private TbRidRunDayService tbRidRunDayService;
    @Resource
    private TUserService tUserService;
    @Resource
    private RfidBgGjxlService rfidBgGjxlService;
    @Resource
    private RfidIcGjclManuService rfidIcGjclManuService;
    @Resource
    private TblBusEmployeeBasicInfoService tblBusEmployeeBasicInfoService;
    @Resource
    private RfidDataShareService rfidDataShareService;
    @Resource
    private RfidRunService rfidRunService;
    @Resource
    private TbTidRunDayService  tbTidRunDayService;
    @Resource
    private TUserFuncService tUserFuncService;
    @Resource
    private DmRidStatusService dmRidStatusService;
    @Resource
    private DmTidStatusService dmTidStatusService;
    @Resource
    private DmTagInOutStatusService dmTagInOutStatusService;
    @Resource
    private RfidService rfidService;
    @Resource
    private TUserLogService tUserLogService;
    @Resource
    private TUserXlService tUserXlService;
    @Resource
    private TbTidVenderService tbTidVenderService;
    @Resource
    private TbLineRfidRunDayService tbLineRfidRunDayService;
    @Resource
    private TbCenterLinkService tbCenterLinkService;
    @Resource
    private TagInOutIdentifyHisService tagInOutIdentifyHisService;
    @Resource
    private JgJiTuanInfoService jgJiTuanInfoService;
    @Resource
    private RfidBgService rfidBgService;

    @RequestMapping("/demo")
    public WebServiceR demo() {
        List<DemoDto> list= new ArrayList<DemoDto>();
        DemoDto dto = new DemoDto();
        dto.setRQ("2025-06-13");
        dto.setYHID("{9E07C90D-4FE0-0B19-7FFF-FE9DFCA8793F}");
        dto.setYHJC("奉贤客运");
        dto.setU_ALLOCATION(3);
        list.add(dto);

        return WebServiceR.result(list.size(),true, JSONUtils.write(list),"Ok");
    }

//    /**
//     * 查询视图searchJgGjxlView
//     * @param yhid
//     * @return
//     */
//    @RequestMapping("/searchJgGjxlView/{yhid}")
//    public R searchJgGjxlView(@PathVariable String yhid){
//
//        return R.success(jgGjxlService.searchJgGjxlView(Stream.of(yhid).collect(Collectors.toList())));
//    }

    /**
     * 查询基站、线路绑定信息
     * @param uId
     * @param pwd
     * @return
     */
    @GetMapping("/WS_YG_FOR_*/WS_YG_FOR_*.asmx/get_BG_GJXL_*")
    public WebServiceR proGetBgGjx(@RequestParam(value = "UID")String uId,@RequestParam(value = "PWD")String pwd ){
        String uri = request.getRequestURI();
        List<String> yhids = new ArrayList<>();
        List<Map<String,String>> mapList = new ArrayList<>();
        if(uri.contains("WS_YG_FOR_BS")){//巴士
            yhids = Stream.of("{8397B231-9F76-3213-3B28-31E4D47DB443}",
                    "{C94F203B-6B26-00E8-7F11-9D5E736F1A2C}",
                    "{5F05D3A1-1BCE-8DB1-9384-15E3802C3453}",
                    "81E4F4C636A10670E044000000000000",
                    "{2579AF06-6A96-A8AB-C6AA-D90FB17F8BF5}").collect(Collectors.toList());

         }else if(uri.contains("WS_YG_FOR_CM")){ //崇明
            yhids.add("{73E852CE-2457-88EC-DFC5-A21D53B1371C}");
        }else if(uri.contains("WS_YG_FOR_FX")){ //奉贤
            yhids.add("293E6986DD805FE0E04400306EF5286F");
        }else if(uri.contains("WS_YG_FOR_JS")){ //金山
            yhids.add("3D48CFBC33C02404E04400306EF5286F");
        }else if(uri.contains("WS_YG_FOR_JSKY")){ //金山
            yhids.add("{737EFA91-91E1-4203-0035-884D1637E1E9}");
        }else if(uri.contains("WS_YG_FOR_LGGJ")){ //临港
            yhids.add("111123243434");
        }else if(uri.contains("WS_YG_FOR_LGJY")){ //临港
            yhids.add("77BBCCE8B1D3143EE044000000000000");
        }else if(uri.contains("WS_YG_FOR_QP")){ //青浦
            yhids = Stream.of("{2203502B-7420-86AF-B324-AF5D210F9F37}",
                    "{24055417-CFF3-944E-E259-D4219B52DD2C}",
                    "{DA1A0239-0ADE-01D5-0F6D-0A99CEB91529}",
                    "590900807E2842A79497FCF7202CE71E").collect(Collectors.toList());
        }else if(uri.contains("WS_YG_FOR_SJ")){ //松江
            yhids.add("{E8CA6900-30E5-501D-8D61-753B6030860E}");
        }


        if(CollUtil.isNotEmpty(yhids)) {
            mapList = rfidBgGjxlService.proGetBgGjx(yhids);
        }
//        Map<String,String> map = new HashMap<>();
//        map.put("RID_UID","010098");
//        map.put("STATION_TYPE","2");
//        map.put("LINE_STANDARD_CODE","502500");
//        mapList.add(map);
//        Map<String,String> map1 = new HashMap<>();
//        map1.put("RID_UID","010098");
//        map1.put("STATION_TYPE","2");
//        map1.put("LINE_STANDARD_CODE","502500");
//        mapList.add(map1);
        return WebServiceR.result(mapList.size(),true,JSONUtils.write(mapList),"OK");
    }

    /**
     * 查询车牌号,电子标签号绑定信息
     * @param uId
     * @param pwd
     * @return
     */
    @GetMapping("/WS_YG_FOR_*/WS_YG_FOR_*.asmx/get_TID_*")
    public WebServiceR proGetTid(@RequestParam(value = "UID")String uId,@RequestParam(value = "PWD")String pwd ){
        String uri = request.getRequestURI();
        List<String> yhids = new ArrayList<>();
        List<Map<String,String>> mapList = new ArrayList<>();
        if(uri.contains("WS_YG_FOR_BS")){//巴士
            yhids = Stream.of("{8397B231-9F76-3213-3B28-31E4D47DB443}",
                    "{C94F203B-6B26-00E8-7F11-9D5E736F1A2C}",
                    "{5F05D3A1-1BCE-8DB1-9384-15E3802C3453}",
                    "81E4F4C636A10670E044000000000000",
                    "{2579AF06-6A96-A8AB-C6AA-D90FB17F8BF5}",
                    "3D48CFBC33C02404E04400306EF5286F",
                    "{73E852CE-2457-88EC-DFC5-A21D53B1371C}").collect(Collectors.toList());

        }else if(uri.contains("WS_YG_FOR_CM")){ //崇明
            yhids.add("{73E852CE-2457-88EC-DFC5-A21D53B1371C}");
        }else if(uri.contains("WS_YG_FOR_FX")){ //奉贤
            yhids.add("293E6986DD805FE0E04400306EF5286F");
        }else if(uri.contains("WS_YG_FOR_JS")){ //金山
            yhids.add("3D48CFBC33C02404E04400306EF5286F");
        }else if(uri.contains("WS_YG_FOR_JSKY")){ //金山
            yhids.add("{737EFA91-91E1-4203-0035-884D1637E1E9}");
        }else if(uri.contains("WS_YG_FOR_LGGJ")){ //临港
            yhids.add("111123243434");
        }else if(uri.contains("WS_YG_FOR_LGJY")){ //临港
            yhids.add("77BBCCE8B1D3143EE044000000000000");
        }else if(uri.contains("WS_YG_FOR_PD")){
            yhids = Stream.of("{59B55119-C11B-5446-C547-921464E8BE54}",
                    "{880B1F15-E277-5E2D-1F4B-2154ABE6CBD0}",
                    "{DEE64F59-5B39-959F-ECD1-A0D97EA1CD4E}",
                    "{E60FC102-DA0A-A4AD-0544-7D6723569569}",
                    "715FEDE6CB815456E044000000000000").collect(Collectors.toList());
        }else if(uri.contains("WS_YG_FOR_QP")){ //青浦
            yhids = Stream.of("{2203502B-7420-86AF-B324-AF5D210F9F37}",
                    "{24055417-CFF3-944E-E259-D4219B52DD2C}",
                    "{DA1A0239-0ADE-01D5-0F6D-0A99CEB91529}",
                    "590900807E2842A79497FCF7202CE71E").collect(Collectors.toList());
        }else if(uri.contains("WS_YG_FOR_SJ")){ //松江
            yhids.add("{E8CA6900-30E5-501D-8D61-753B6030860E}");
        }


        if(CollUtil.isNotEmpty(yhids)) {
            mapList = rfidIcGjclManuService.proGetTid(yhids);
        }

        return WebServiceR.result(mapList.size(),true,JSONUtils.write(mapList),"OK");
    }


    /**
     * 读取人与人卡关系表
     * @return
     */
    @GetMapping("/WS_YG_FOR_*/WS_YG_FOR_*.asmx/SelectEmp_Card")
    public Map selectEmpCard(){
        List<TblBusEmployeeBasicInfo> list = tblBusEmployeeBasicInfoService.selectEmpCard();
        Map<String,Object> map = new HashMap<>();

        if(CollUtil.isNotEmpty(list)) {

            List<Map<String,String>> mapList = new ArrayList<>();
            for(TblBusEmployeeBasicInfo t:list){
                Map<String,String> itemMap = new HashMap<>();
                map.put("Name",t.getName());
                map.put("Cardno",t.getCardNo());
                mapList.add(itemMap);
            }
            map.put("datas",mapList);

        }else{
            map.put("total","0");
            map.put("datas",new ArrayList<>());
        }

        return map;
    }


    /**
     * 读取基站与站点关系表
     * @return
     */
    @GetMapping("/WS_YG_FOR_*/WS_YG_FOR_*.asmx/SelectRFID_STAT")
    public Map SelectRfidStat(){
        List<SelectRfidStatDto> list =  rfidBgGjxlService.SelectRfidStat();
        Map<String,Object> map = new HashMap<>();
        if(CollUtil.isNotEmpty(list)){
            map.put("total",String.valueOf(list.size()));
            map.put("datas",list);
        }else{
            map.put("total","0");
            map.put("datas",new ArrayList<>());
        }
        return map;
    }
    /**
     *
     * @param JgGjxl
     * @return
     */
    @GetMapping("/searchByList")
    public R searchByList( JgGjxl JgGjxl){
        return R.success(jgGjxlService.searchByList(JgGjxl));
    }
    /**
     *
     * @param jgxlid
     * @return
     */
    @RequestMapping("/searchById/{jgxlid}")
    public R searchById(@PathVariable(value = "jgxlid") Integer jgxlid){
        return R.success(jgGjxlService.searchById(jgxlid));
    }

    /**
     * 插入JkXlxxMid表
     * @param jkXlxxMid
     * @return
     */
    @PostMapping("/saveJkXlxxMid")
    public R saveJkXlxxMid(@RequestBody JkXlxxMid jkXlxxMid){
        jkXlxxMid.setUpdt(LocalDateTime.now());
        boolean isSave = jkXlxxMidService.save(jkXlxxMid);
        return isSave ? R.success() :R.fail("插入失败");
    }

    /**
     * 插入JkXlxxMid表
     * @param jkXlzjMid
     * @return
     */
    @PostMapping("/saveJkXlzjMid")
    public R saveJkXlzjMid(@RequestBody JkXlzjMid jkXlzjMid){
        jkXlzjMid.setUpdt(LocalDateTime.now());
        boolean isSave = jkXlzjMidService.save(jkXlzjMid);
        return isSave ? R.success() :R.fail("插入失败");
    }

    /**
     * 插入JkXlbcsk表
     * @param jkXlbcsk
     * @return
     */
    @PostMapping("/saveJkXlbcsk")
    public R saveJkXlbcsk(@RequestBody JkXlbcsk jkXlbcsk){
        jkXlbcsk.setUpdt(LocalDateTime.now());
        boolean isSave = jkXlbcskService.save(jkXlbcsk);
        return isSave ? R.success() :R.fail("插入失败");
    }


    /**
     * 插入jkXlbcskDetail表
     * @param jkXlbcskDetail
     * @return
     */
    @PostMapping("/jkXlbcskDetail")
    public R saveJkXlbcsk(@RequestBody JkXlbcskDetail jkXlbcskDetail){
//        jkXlbcskDetail.(LocalDateTime.now());
        boolean isSave = jkXlbcskDetailService.save(jkXlbcskDetail);
        return isSave ? R.success() :R.fail("插入失败");
    }

    /**
     * 插入jkLdxxIn表
     * @param jkLdxxIn
     * @return
     */
    @PostMapping("/saveJkLdxxIn")
    public R saveJkLdxxIn(@RequestBody JkLdxxIn jkLdxxIn){
        jkLdxxIn.setUpdt(LocalDateTime.now());
        boolean isSave = jkLdxxInService.save(jkLdxxIn);
        return isSave ? R.success() :R.fail("插入失败");
    }

    /**
     * 获取tbRidVenderList
     * @return list
     */
    @GetMapping("/getTbRidVenderList")
    public R tbRidVenderList(){
        return R.success(tbRidVenderService.list());
    }

    /**
     * 分页tbRidRunDayService
     * 对应原系统的存储过程：RFID_RUN.dbo.GET_QUALITY_RID_DAYs ，RFID_RUN.dbo.GET_QUALITY_RID_DAY
     * @param page    分页
     * @param search 查询参数列表
     * @return 记录集合
     */
    @GetMapping("/getTbRidRunDayByPage.aspx")
    public R getTbRidRunDayByPage(Page page, TbRidRunDayDto search) {
        return R.success(tbRidRunDayService.searchByPage(page, search));
    }
    /**
     * 获取TuserList
     * @return list
     */
    @GetMapping("/tUserList")
    public R tUserList(){
        return R.success(tUserService.selectAllUsers());
    }


    /**
     * 获取TuserList
     * @return list
     */
    @RequestMapping("/WS_*/WS_*.asmx/AddUser")
    public WebServiceR addUser(@RequestBody TUser user){
        String uri = request.getRequestURI();
        if(uri.contains("WS_RFID/WS_RFID")) {
            int isSave = tUserService.saveRfid( user);
            if(isSave == 0) {
                return WebServiceR.result(1, true, null, "用户新增成功");
            }else if(isSave == 1){
                return WebServiceR.result(0, false, null, "用户已存在");
            }else{
                return WebServiceR.result(0, false, null, "用户新增失败");
            }

        }

        return WebServiceR.result(0, false, null, "没找到对应的插入url");
    }


    /**
     * 获取TuserList
     * @return list
     */
    @RequestMapping("/WS_RFID*/WS_*.asmx/GET_DATASHARE_LINK")
    public String GET_DATASHARE_LINK(String UID,String key ){
        List<GetDataShareLinkDto>  list = rfidDataShareService.getDataShareLink();

        WebServiceR r =  WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0, false,
                CollUtil.isNotEmpty(list)?JSONUtils.writeExcludeNull(list):null, "");
        return JSONUtils.write(r);
    }



    /**
     * 基站营运质量报告(一个基站多天)GET_QUALITY_RID_DAYs
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_RID_DAYs")
    public String getQualityRidDays( SearchGetQualityRidDayDto search) {
        return JSONUtils.write(rfidRunService.getQualityRidDays(search));
    }

    /**
     * 基站营运质量报告(多个基站一天)GET_QUALITY_RIDs_DAY
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_RIDs_DAY")
    public String getQualityRidsDay(  SearchGetQualityRidDayDto search) {
        return JSONUtils.write(rfidRunService.getQualityRidsDay(search));
    }


    /**
     * 基站营运质量报告(多个基站一天,按照RID_NAME查询)GET_QUALITY_RIDs_DAY_by_RID_NAME
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_RIDs_DAY_by_RID_NAME")
    public String getQualityRidsDayByRidName(  SearchGetQualityRidDayDto search) {
        return JSONUtils.write(rfidRunService.getQualityRidsDayByRidName(search));
    }

    /**
     * 基站营运质量报告(多个基站一天,按照RID_SERIAL查询)GET_QUALITY_RIDs_DAY_by_RID_SERIAL
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_RIDs_DAY_by_RID_SERIAL")
    public String getQualityRidsDayByRidSerial( SearchGetQualityRidDayDto search){
        return JSONUtils.write(rfidRunService.getQualityRidsDayByRidSerial(search));
    }

    /**
     * //电子标签营运质量报告(多张电子标签一天，按照TID_UID查询) GET_QUALITY_TIDs_DAY_by_TID_UID
     * @param searchGetQualityTidDayDto
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_TIDs_DAY_by_TID_UID")
    public String  getQualityTidsDayByTidUid( SearchGetQualityTidDayDto searchGetQualityTidDayDto){
        return JSONUtils.write(rfidRunService.getQualityTidsDayByTidUid(searchGetQualityTidDayDto));
    }

    /**
     * 电子标签营运质量报告(多张电子标签一天，按照TID_xuhao查询) GET_QUALITY_TIDs_DAY_by_TID_xuhao
     * @param searchGetQualityTidDayDto
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_TIDs_DAY_by_TID_xuhao")
    public String getQualityTidsDayByTidXuhao(SearchGetQualityTidDayDto searchGetQualityTidDayDto){
        return JSONUtils.write(rfidRunService.getQualityTidsDayByTidXuhao(searchGetQualityTidDayDto));

    }

    /**
     * 电子标签营运质量报告(一张电子标签多天)GET_QUALITY_TID_DAYs
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_TID_DAYs")
    public WebServiceR getQualityTidDays(SearchGetQualityTidDayDto search ){
        Page page = new Page(StringUtils.isNotBlank(search.getPage())? Long.parseLong(search.getPage()): 1,
                StringUtils.isNotBlank(search.getPageCount())? Long.parseLong(search.getPageCount()): 10);
        IPage<TbTidRunDayDto> ipage = tbTidRunDayService.getQualityTidDays(page, search);
        if(ipage != null){
           return WebServiceR.result((int)ipage.getTotal(),
                   true,CollUtil.isNotEmpty(ipage.getRecords())?
                   JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return  WebServiceR.result(0,
                    true,null, "");

        }
    }

    /**
     * 电子标签营运质量报告(多张电子标签一天)exec RFID_RUN.dbo.GET_QUALITY_TIDs_DAY '{0}', '{1}', {2}, {3}
     * @param search
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GET_QUALITY_TIDs_DAY")
    public WebServiceR getQualityTidsDay(SearchGetQualityTidDayDto search ){
        Page page = new Page(StringUtils.isNotBlank(search.getPage())? Long.parseLong(search.getPage()): 1,
                StringUtils.isNotBlank(search.getPageCount())? Long.parseLong(search.getPageCount()): 10);
        IPage<TbTidRunDayDto> ipage = tbTidRunDayService.getQualityTidsDay(page, search);
        if(ipage != null){
            return  WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return WebServiceR.result(0,
                    true,null, "");

        }
    }


    /**
     * 返回指定用户的功能权限GetFuncByUID
     * @param callerUid
     * @param key
     * @param filterUid
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/GetFuncByUID")
    public String getFuncByUID(@RequestParam("CallerUID")String callerUid, @RequestParam("key")String key, @RequestParam("FilterUID")String filterUid){

        List<TUserFunc> list = tUserFuncService.list(Wrappers.<TUserFunc>lambdaQuery().eq(TUserFunc::getUid,filterUid));
        return JSONUtils.write(WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK"));
    }

    /**
     * GetLINESTATION
     * @param uid
     * @param key
     * @param jzmc
     * @return
     */
    @GetMapping("/WS_RFID/WS_RFID.asmx/GetLINESTATION")
    public String searchJgGjxlzdView(@RequestParam("UID")String uid, @RequestParam("key")String key, @RequestParam("jzmc")int jzmc){
        JgGjxlzdViewDto search = new JgGjxlzdViewDto();
        search.setJgxlid(jzmc);
        List<JgGjxlzdViewDto> list = jgGjxlService.searchJgGjxlzdView(search);
        return JSONUtils.write(WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK"));
    }


    /**
     * GetRIDSTATION
     * @param bgno
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/GetRIDSTATION")
    public String proGetRidStation(@RequestParam("bgno")String bgno){
        List<ProGetRidStationDto> list = rfidBgGjxlService.proGetRidStation(bgno);
        return JSONUtils.write(WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,
                CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK"));
    }

    /**
     * GetRIDStatusList
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/GetRIDStatusList ")
    public String getRIDStatusList(){
        List<DmRidStatus> list = new ArrayList<>();
        list.add(new DmRidStatus(0,"全部"));
        list.addAll(dmRidStatusService.list());
        return JSONUtils.write(WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK"));
    }

    /**
     * getTIDStatusList
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/GetTIDStatusList")
    public WebServiceR getTIDStatusList(){
        List<DmTidStatus> list = new ArrayList<>();
        list.add(new DmTidStatus(0,"全部"));
        list.addAll(dmTidStatusService.list());
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");
    }

    /**
     * Get_RID_TID_LIV
     * @param uid
     * @param key
     * @param tagInOutId
     * @param ridVendorId
     * @param page
     * @param pageCount
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/Get_RID_TID_LIV")
    public WebServiceR getRidTidLiv(@RequestParam("UID")String uid,
                                    @RequestParam("key")String key,
                                    @RequestParam("TAG_IN_OUT_ID")String tagInOutId,
                                    @RequestParam("RIDVendorID")String ridVendorId,
                                    @RequestParam("page")String page,
                                    @RequestParam("pageCount")String pageCount){

        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);
        GetRidTidLivDto search = new GetRidTidLivDto();
        search.setTAG_IN_OUT_ID(StringUtils.isNotBlank(tagInOutId)? Integer.parseInt(tagInOutId) : 0);
        search.setRID_VENDER_REGNUM(ridVendorId);
        IPage<GetRidTidLivDto> ipage =  tbRidVenderService.getRidTidLiv(p, search);
        if(ipage != null){
            return WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.writeExcludeNull(ipage.getRecords()):null, "");
        }else{
            return  WebServiceR.result(0,
                    true,null, "");
        }

    }

    /**
     * Get_RID_TID_LIV_DETAIL
     * @param uid
     * @param key
     * @param tagInOutId
     * @param ridVendorId
     * @param page
     * @param pageCount
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/Get_RID_TID_LIV_DETAIL")
    public WebServiceR getRidTidLivDetail(@RequestParam("UID")String uid,
                                    @RequestParam("key")String key,
                                    @RequestParam("TAG_IN_OUT_ID")String tagInOutId,
                                    @RequestParam("RIDVendorID")String ridVendorId,
                                    @RequestParam("jgxlids") String jgxlids,
                                    @RequestParam("page")String page,
                                    @RequestParam("pageCount")String pageCount){

        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);
        GetRidTidLivDetailDto search = new GetRidTidLivDetailDto();
        search.setTAG_IN_OUT_ID(tagInOutId);
        search.setRID_VENDER_REGNUM(ridVendorId);
        if(StringUtils.isNotBlank(jgxlids)){
            search.setJgxlids(Arrays.asList(StringUtils.split(jgxlids, ",")));
        }

        IPage<GetRidTidLivDetailDto> ipage =  tbRidVenderService.getRidTidLivDetail(p, search);
        if(ipage != null){
            return WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.writeExcludeNull(ipage.getRecords()):null, "OK");
        }else{
            return  WebServiceR.result(0,
                    true,null, "");
        }

    }

    /**
     * Get_TAG_IN_OUT_STATUS
     * @param uid
     * @param key
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/Get_TAG_IN_OUT_STATUS")
    public WebServiceR  getTagInOutStatus(@RequestParam("UID")String uid,@RequestParam("key")String key){
        List<DmTagInOutStatus> list = dmTagInOutStatusService.list();
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.writeExcludeNull(list):null,"查询成功");
    }


    /**
     * InsertRFIDBGGJXLFORTERMINAL
     * @param uid
     * @param key
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/InsertRFIDBGGJXLFORTERMINAL")
    public String  insertRFIDBGGJXLFORTERMINAL (@RequestParam("UID")String uid,
                                                @RequestParam("key")String key,
                                                @RequestParam("bgno")String bgno,
                                                @RequestParam("jgxlid")String jgxlid,
                                                @RequestParam("zdlx")String zdlx){
        Integer num = rfidService.insertRFIDBGGJXLFORTERMINAL(uid,bgno,Integer.parseInt(jgxlid),Integer.parseInt(zdlx));
        return "修改成功";
    }

    /**
     * RemoveUserByUID
     * @param uid
     * @param key
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/RemoveUserByUID")
    public String  removeUserByUID (@RequestParam("CallerUID")String callerUid,
                                    @RequestParam("key")String key,
                                    @RequestParam("UID")String uid){
        try {
              tUserService.proRemoveUserByUID(uid);
            return "修改成功";
        } catch (Exception e) {

            return "修改失败";
        }

    }



    /**
     * SaveLogin
     * @param uid
     * @param key
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/SaveLogin")
    public String  saveLogin (@RequestParam("UID")String uid,
                              @RequestParam("key")String key,
                              @RequestParam("SessionID")String sessionId,
                              @RequestParam("HostAddress")String hostAddress){

        TUserLog tUserLog = new TUserLog();
        tUserLog.setUid(uid);
        tUserLog.setSessionId(sessionId);
        tUserLog.setHostAddress(hostAddress);
        tUserLog.setLoginDt(LocalDateTime.now());
        tUserLogService.save(tUserLog);
        return "保存用户登录信息成功";
    }

    /**
     * SaveLogin
     * @param uid
     * @param key
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/SaveLogout")
    public String  saveLogin (@RequestParam("UID")String uid,
                              @RequestParam("key")String key,
                              @RequestParam("SessionID")String sessionId){

        TUserLog tUserLog = new TUserLog();
        tUserLog.setUid(uid);
        tUserLog.setSessionId(sessionId);

        tUserLog.setLoginDt(LocalDateTime.now());
        tUserLogService.update(Wrappers.<TUserLog>lambdaUpdate()
                .set(TUserLog::getLogoutDt,LocalDateTime.now())
                .eq(TUserLog::getSessionId,sessionId).eq(TUserLog::getUid,uid));
        return "保存用户登出信息成功";
    }

    /**
     * 用户功能权限更新UpdateFunc
     * @param uid
     * @param key
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/UpdateFunc")
    public String  updateFunc (@RequestParam("CallerUID")String callerUid,
                              @RequestParam("key")String key,
                              @RequestParam("uid")String uid,
                               @RequestParam("adds")String adds,
                               @RequestParam("dels")String dels){

        try {
            tUserFuncService.proUpdateUserFuncByUID(uid,adds,dels);
        } catch (Exception e) {
            return "用户功能权限更新失败:"+e.getMessage();
        }
        return "用户功能权限更新成功";
    }


    /**
     * 修改登录密码UpdatePassword
     * @param uid
     * @param key
     * @param pwd
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/UpdatePassword")
    public String  updateFunc (@RequestParam("UID")String uid,
                               @RequestParam("key")String key,
                               @RequestParam("PWD")String pwd){

        boolean isupdate = tUserService.update(Wrappers.<TUser>lambdaUpdate().set(TUser::getPwd,pwd).eq(TUser::getUid,uid));
        return "登录密码修改成功";
    }


    /**
     * 修改用户名UpdateUserByUID
     * @param callerUid
     * @param uid
     * @param key
     * @param username
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/UpdateUserByUID")
    public String  updateFunc (@RequestParam("CallerUID")String callerUid,
                               @RequestParam("UID")String uid,
                               @RequestParam("key")String key,
                               @RequestParam("username")String username){

        boolean isupdate = tUserService.update(Wrappers.<TUser>lambdaUpdate().set(TUser::getUserName,username).eq(TUser::getUid,uid));
        return "登录密码修改成功";
    }

    /**
     * 更新用户的线路权限 UpdateXL
     * @param callerUid
     * @param key
     * @param uid
     * @param adds
     * @param dels
     * @return
     */
    @PostMapping("/WS_RFID*/WS_*.asmx/UpdateXL")
    public String  updateXl(@RequestParam("CallerUID")String callerUid,
                               @RequestParam("key")String key,
                               @RequestParam("uid")String uid,
                               @RequestParam("adds")String adds,
                               @RequestParam("dels")String dels){
        try {
            tUserXlService.updateXL(uid, adds, dels);
        } catch (Exception e) {
             return "用户线路权限更新失败" +e.getMessage();
        }
        return "用户线路权限更新成功";
    }


    /**
     * getLINE
     * @param uid
     * @param key
     * @param jzmc
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getLINE")
    public WebServiceR getLINE(@RequestParam("UID")String uid,@RequestParam("key")String key,@RequestParam("jzmc")String jzmc){
        List<JgGjxl> jgGjxls = jgGjxlService.searchJgGjxlByLine(jzmc);
        if(CollUtil.isNotEmpty(jgGjxls)){
            List<Map<String,String>> mapList = new ArrayList<>();
            jgGjxls.forEach(item->{
                Map<String,String> map = new HashMap<>();
                map.put("JGXLID",item.getJgxlid() != null?item.getJgxlid().toString():"");
                map.put("XLMC",item.getXlmc());
                mapList.add(map);
            });
            return WebServiceR.result(mapList.size(),true,JSONUtils.writeExcludeNull(mapList), "OK");
        }else{
            return WebServiceR.result(0,true,null, "OK");
        }
    }


    /**
     * 基站运转情况  getRIDLiv
     * @param uid
     * @param key
     * @param ridStatusId
     * @param ridVendorId
     * @param page
     * @param pageCount
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getRIDLiv")
    public WebServiceR getRidLiv(@RequestParam("UID")String uid,
                                 @RequestParam("key")String key,
                                 @RequestParam("RIDStatusID") String ridStatusId,
                                 @RequestParam("RIDVendorID") String ridVendorId,
                                 @RequestParam("page")String page,
                                 @RequestParam("pageCount")String pageCount){
        return rfidRunService.getRidLiv(uid,Integer.parseInt(ridStatusId),ridVendorId,Integer.parseInt(page),Integer.parseInt(pageCount));

    }

    /**
     * 基站运转情况(加入查询关键字:RID_NAME) getRIDLiv_by_RID_NAME
     * @param uid
     * @param key
     * @param ridStatusId
     * @param ridVendorId
     * @param page
     * @param pageCount
     * @param ridName
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getRIDLiv_by_RID_NAME")
    public WebServiceR getRidLivByRidName(@RequestParam("UID")String uid,
                                 @RequestParam("key")String key,
                                 @RequestParam("RIDStatusID") String ridStatusId,
                                 @RequestParam("RIDVendorID") String ridVendorId,
                                 @RequestParam("page")String page,
                                 @RequestParam("pageCount")String pageCount,
                                 @RequestParam("RID_NAME")String ridName){
        return rfidRunService.getRidLivByRidName(uid, key, ridStatusId, ridVendorId, page, pageCount, ridName);

    }

    /**
     * 基站运转情况(加入查询关键字:RID_SERIAL)getRIDLiv_by_RID_SERIAL
     * @param uid
     * @param key
     * @param ridStatusId
     * @param ridVendorId
     * @param page
     * @param pageCount
     * @param ridSerial
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getRIDLiv_by_RID_SERIAL")
    public WebServiceR getRidLivByRidSerial(@RequestParam("UID")String uid,
                                          @RequestParam("key")String key,
                                          @RequestParam("RIDStatusID") String ridStatusId,
                                          @RequestParam("RIDVendorID") String ridVendorId,
                                          @RequestParam("page")String page,
                                          @RequestParam("pageCount")String pageCount,
                                          @RequestParam("RID_SERIAL")String ridSerial){
        return rfidRunService.getRidLivByRidSerial(uid, key, ridStatusId, ridVendorId, page, pageCount, ridSerial);

    }

    /**
     * getRIDVendors
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getRIDVendors")
    public WebServiceR getRIDVendors(@RequestParam("UID") String uid, @RequestParam("key") String key){
        List<TbRidVender> list = new ArrayList<>();
        TbRidVender tbRidVender = new TbRidVender();
        tbRidVender.setRidVenderRegnum("00");
        tbRidVender.setRidVender("全部");
        list.add(tbRidVender);
        list.addAll(tbRidVenderService.list());
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");
    }


    /**
     * 电子标签运转情况 getTIDLiv
     * @param uid
     * @param key
     * @param tidStatusId
     * @param tidVendorId
     * @param yhid
     * @param page
     * @param pageCount
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getTIDLiv")
    public WebServiceR getTidLiv(@RequestParam("UID") String uid,
                                 @RequestParam("key") String key,
                                 @RequestParam("TIDStatusID")String tidStatusId,
                                 @RequestParam("TIDVendorID")String tidVendorId,
                                 @RequestParam("YHID")String yhid,
                                 @RequestParam("page")String page,
                                 @RequestParam("pageCount")String pageCount){
        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);

        GetTidLivDto search = new GetTidLivDto();
        search.setUsername(uid);
        search.setTidStatusId(Integer.parseInt(tidStatusId));
        search.setTidVenderRegnum(tidVendorId);
        search.setYhid(yhid);
        IPage<GetTidLivDto> ipage = dmTidStatusService.getTidLiv(p,search);
        if(ipage != null){
            return  WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return  WebServiceR.result(0,
                    true,null, "");

        }

    }

    /**
     * 电子标签运转情况(加入查询关键字:TID_UID)
     * @param uid
     * @param key
     * @param tidStatusId
     * @param tidVendorId
     * @param yhid
     * @param page
     * @param pageCount
     * @param tidUid
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getTIDLiv_by_TID_UID")
    public WebServiceR getTidLivByTidUid(@RequestParam("UID") String uid,
                                 @RequestParam("key") String key,
                                 @RequestParam("TIDStatusID")String tidStatusId,
                                 @RequestParam("TIDVendorID")String tidVendorId,
                                 @RequestParam("YHID")String yhid,
                                 @RequestParam("page")String page,
                                 @RequestParam("pageCount")String pageCount,
                                 @RequestParam("TID_UID")String tidUid){
        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);

        GetTidLivDto search = new GetTidLivDto();
        search.setUsername(uid);
        search.setTidStatusId(Integer.parseInt(tidStatusId));
        search.setTidVenderRegnum(tidVendorId);
        search.setYhid(yhid);
        search.setTidUid(tidUid);
        IPage<GetTidLivDto> ipage = dmTidStatusService.getTidLiv(p,search);
        if(ipage != null){
            return  WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return  WebServiceR.result(0,
                    true,null, "");

        }

    }

    /**
     * 电子标签运转情况(加入查询关键字:TID_xuhao)getTIDLiv_by_TID_xuhao
     * @param uid
     * @param key
     * @param tidStatusId
     * @param tidVendorId
     * @param yhid
     * @param page
     * @param pageCount
     * @param tidxuhao
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getTIDLiv_by_TID_xuhao")
    public WebServiceR getTidLivByTidxuhao(@RequestParam("UID") String uid,
                                         @RequestParam("key") String key,
                                         @RequestParam("TIDStatusID")String tidStatusId,
                                         @RequestParam("TIDVendorID")String tidVendorId,
                                         @RequestParam("YHID")String yhid,
                                         @RequestParam("page")String page,
                                         @RequestParam("pageCount")String pageCount,
                                         @RequestParam("TID_xuhao")String tidxuhao){
        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);

        GetTidLivDto search = new GetTidLivDto();
        search.setUsername(uid);
        search.setTidStatusId(Integer.parseInt(tidStatusId));
        search.setTidVenderRegnum(tidVendorId);
        search.setYhid(yhid);
        search.setTidxuhao(tidxuhao);
        IPage<GetTidLivDto> ipage = dmTidStatusService.getTidLiv(p,search);
        if(ipage != null){
            return  WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return  WebServiceR.result(0,
                    true,null, "");

        }

    }


    /**
     * getTIDVendors
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/getTIDVendors")
    public WebServiceR getTIDVendors(){
        List<TbTidVender> list = new ArrayList<>();
        list.add(new TbTidVender("00","全部"));
        list.addAll(tbTidVenderService.list());
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");
    }


    /**
     * get_Center_link
     * @param uid
     * @param key
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/get_Center_link")
    public WebServiceR getCenterLink(@RequestParam("UID")String uid,
                                            @RequestParam("key")String key){
        List<GetCenterLinkDto> list =rfidRunService.getCenterLink();
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }

    /**
     *  RFID系统基站和电子标签运行情况线路汇总 get_LINE_RFID_RUN_DAY
     * @param uid
     * @param key
     * @param rq
     * @param full
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/get_LINE_RFID_RUN_DAY")
    public WebServiceR proGetTbLineRfidRunDay(@RequestParam("UID")String uid,
                                              @RequestParam("key")String key,
                                              @RequestParam("rq")String rq,
                                              @RequestParam("full")String full){
        ProGetTbLineRfidRunDayDto proGetTbLineRfidRunDayDto = new ProGetTbLineRfidRunDayDto();
        proGetTbLineRfidRunDayDto.setUsername(uid);
        proGetTbLineRfidRunDayDto.setDt(rq);
        if(StringUtils.isNotBlank(full)){
            proGetTbLineRfidRunDayDto.setFull(Integer.parseInt(full));
        }

        List<ProGetTbLineRfidRunDayDto> list = tbLineRfidRunDayService.proGetTbLineRfidRunDay(proGetTbLineRfidRunDayDto);
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }


    /**
     * get_Center_link_detail
     * @param uid
     * @param key
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/get_Center_link_detail")
    public WebServiceR getCenterLinkDetail(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key){
        List<GetCenterLinkDetailDto> list =rfidRunService.getCenterLinkDetail();
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }

    /**
     * 数据通信质量报告(一天详细) get_QUALITY_Center_DAY_Detail
     * @param uid
     * @param key
     * @param rq
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/get_QUALITY_Center_DAY_Detail")
    public WebServiceR tbCenterLinkService(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key,
                                           @RequestParam("rq")String rq){
        List<TbCenterLinkDto> list = tbCenterLinkService.getQualityCenterDayDetail(StringUtils.replace(rq,"-",""));

        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,
                true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");
    }

    /**
     * 数据通信质量报告(多天)get_QUALITY_Center_DAYs
     * @param uid
     * @param key
     * @param dateStartStr
     * @param dateEndStr
     * @param page
     * @param pageCount
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/get_QUALITY_Center_DAYs")
    public WebServiceR tbCenterLinkService(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key,
                                           @RequestParam("rq1")String dateStartStr,
                                           @RequestParam("rq2")String dateEndStr,
                                           @RequestParam("page")String page,
                                           @RequestParam("pageCount")String pageCount){

        Page p = new Page(StringUtils.isNotBlank(page)? Long.parseLong(page): 1,
                StringUtils.isNotBlank(pageCount)? Long.parseLong(pageCount): 10);
        TbCenterLinkDto search = new TbCenterLinkDto();
        search.setDateStartStr(StringUtils.replace(dateStartStr,"-",""));
        search.setDateEndStr(StringUtils.replace(dateEndStr,"-",""));
        IPage<TbCenterLinkDto> ipage =tbCenterLinkService.getQualityCenterDays(p,search);
        if(ipage != null){
            return  WebServiceR.result((int)ipage.getTotal(),
                    true,CollUtil.isNotEmpty(ipage.getRecords())?
                            JSONUtils.write(ipage.getRecords()):null, "OK");

        }else{
            return  WebServiceR.result(0,
                    true,null, "");

        }
    }


    /**
     * 基站进出站数据跟踪 get_RID_IN_OUT_DAY
     * @param uid
     * @param key
     * @param rq
     * @param bgNo
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/get_RID_IN_OUT_DAY")
    public WebServiceR proGetRidInOutDay(@RequestParam("UID")String uid,
                                         @RequestParam("key")String key,
                                         @RequestParam("rq")String rq,
                                         @RequestParam("BGNO")String bgNo){
        ProGetRidInOutDayDto search = new ProGetRidInOutDayDto();
        search.setDate(DateUtils.StrToLocalDate(rq,DateUtils.FORMAT_SHORT));
        search.setBgNo(bgNo);
        List<ProGetRidInOutDayDto> list = tagInOutIdentifyHisService.proGetRidInOutDay(search);
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }

    /**
     * 企业监测设备质量汇总报告 get_TB_CZCL_RFID_DAY
     * @param rq
     * @return
     */
    @GetMapping("/WS_*/WS_*.asmx/get_TB_CZCL_RFID_DAY")
    public WebServiceR proGetTbCzclRfidDay(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key,
                                           @RequestParam("rq")String rq){

        List<ProGetTbCzclRfidDayDto> list = jgJiTuanInfoService.proGetTbCzclRfidDay(StringUtils.replace(rq,"-",""));
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");
    }

    /**
     * 企业线路监测质量汇总报告 get_TB_CZXL_RFID_DAY
     * @param uid
     * @param key
     * @param rq
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/get_TB_CZXL_RFID_DAY")
    public WebServiceR proGetTbCzxlRfidDay(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key,
                                           @RequestParam("rq")String rq){
        List<ProGetTbCzxlRfidDayDto> list = rfidRunService.proGetTbCzxlRfidDay(rq);
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }

    /**
     * 电子标签进出站数据跟踪get_TID_IN_OUT_DAY
     * @param uid
     * @param key
     * @param rq
     * @param icon
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/get_TID_IN_OUT_DAY")
    public WebServiceR proGetTidInOutDay(@RequestParam("UID")String uid,
                                           @RequestParam("key")String key,
                                           @RequestParam("rq")String rq,
                                         @RequestParam("ICNO")String icon){
        List<ProGetTidInOutDayDto> list = rfidRunService.proGetTidInOutDay(rq,icon);
        return WebServiceR.result(CollUtil.isNotEmpty(list)?list.size():0,true,CollUtil.isNotEmpty(list)?JSONUtils.write(list):null,"OK");

    }

    /**
     * getriduid
     * @param uid
     * @param key
     * @param jzmc
     * @return
     */
    @GetMapping("/WS_RFID*/WS_*.asmx/getriduid")
    public WebServiceR getriduid(@RequestParam("UID")String uid,
                                         @RequestParam("key")String key,
                                         @RequestParam("jzmc")String jzmc){
        List<RfidBg> list = rfidBgService.selectByTop(uid,10);
        if(CollUtil.isNotEmpty(list)){
            List<Map<String,String>> mapList = new ArrayList<>();
            list.forEach(r-> {
                Map<String,String> map = new HashMap<>();
                map.put("RID_SERIAL",r.getBGNO());
                mapList.add(map);
            });
            return WebServiceR.result(CollUtil.isNotEmpty(mapList)?mapList.size():0,true,CollUtil.isNotEmpty(mapList)?JSONUtils.write(mapList):null,"OK");
        }
        return WebServiceR.result(0,true,null,"OK");

    }
//    public static  void main(String args[]){
//        String str = "{\"RQ\":\"2025-06-13\",\"YHID\":\"{9E07C90D-4FE0-0B19-7FFF-FE9DFCA8793F}\",\"YHJC\":\"奉贤客运\",\"U_ALLOCATION\":3}";
//        System.out.println(JSONUtils.readAsMap(str).get("RQ"));
//    }
}
